package unit3_1012.test2;
/*
 * 两个类均有属性：昵称name，健康值health，性别sex。
猫类Cat独有懒度lazy属性。
 */
public class Cat {
	
	private String name;
	private int health;
	private String sex;
	private int lazy;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getHealth() {
		return health;
	}
	public void setHealth(int health) {
		if(health<1 || health>100) {
			health=60;
		}
		this.health = health;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public int getLazy() {
		return lazy;
	}
	
	public void setLazy(int lazy) {
		if(lazy<1 || lazy>10) {
			lazy=5;
		}
		this.lazy = lazy;
	}
	
	/*
	 * 两个类里均有宠物自白的方法show，展示宠物的信息，包括昵称，性别，健康值，与主人的亲密度或懒度。
	 */
	public void show() {
		System.out.println("宠物猫的自白：\n昵称："+name+",性别："+sex+",健康值："+health+",懒度："+lazy);
	}
	
}
